<template>
  <swiper ref="mySwiper" :options="swiperOptions">
    <swiper-slide>
      <img src="@/assets/images/banner1.jpg" width="100%" alt="">
      </swiper-slide>
    <swiper-slide>
      <img src="@/assets/images/banner3.jpg" width="100%" alt="">
    </swiper-slide>
    <swiper-slide>
      <img src="@/assets/images/banner2.jpg" width="100%" alt="">
    </swiper-slide>
    <!-- 轮播点 -->
    <div class="swiper-pagination" slot="pagination"></div>
    <!-- 导航按钮 -->
    <div class="swiper-button-prev" slot="button-prev"></div>
    <div class="swiper-button-next" slot="button-next"></div>
  </swiper>
</template>

<script>
export default {
  data() {
    return {
      swiperOptions: {//swiper配置信息
        pagination: { //分页器
          el: '.swiper-pagination'
        },
        navigation: {//如果需要前进后退按钮
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev'
        },
        loop: true, //自动播放
        autoplay: {
          delay: 3000,
          stopOnLastSlide: false,
          disableOnInteraction: false
        },
      }
    }
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper
    }
  },
  mounted() {
    this.swiper.slideTo(3, 1000, false)
  }
}
</script>

<style lang="less" scoped>
.swiper-button-prev {
  color: #fff;
}
.swiper-button-next {
  color: #fff;
}


</style>